package com.example.supernote.ui.utils

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.example.supernote.R

/**
 * 获取指定模式下 body 显示的额外信息
 */
@Composable
fun getShowInfos(dialogTitle: String): Map<String, String> =
    when (dialogTitle) {
        stringResource(R.string.note_extract_outline),
        stringResource(R.string.note_extract_summary) -> mapOf(
            "aiMode" to stringResource(R.string.note_extract),
            "progressInfo" to stringResource(R.string.note_extract_loading),
            "confirmButtonText" to stringResource(R.string.note_insert_begin),
            "resultTip" to stringResource(R.string.note_has_inserted_begin)
        )
        stringResource(R.string.note_polish_text) -> mapOf(
            "aiMode" to stringResource(R.string.note_polish),
            "progressInfo" to stringResource(R.string.note_polish_loading),
            "confirmButtonText" to stringResource(R.string.note_replace_origin),
            "resultTip" to stringResource(R.string.note_has_replaced_origin)
        )
        stringResource(R.string.note_upload_image) -> mapOf(
            "method" to "image",
            "tip" to stringResource(R.string.note_uploadimage_tip),
            "takeMediaBefore" to stringResource(R.string.note_take_image_before),
            "takeMediaAfter" to stringResource(R.string.note_take_image_after)
        )
        stringResource(R.string.note_upload_audio) -> mapOf(
            "method" to "audio",
            "tip" to stringResource(R.string.note_uploadaudio_tip),
            "takeMediaBefore" to stringResource(R.string.note_take_audio_before),
            "takeMediaAfter" to stringResource(R.string.note_take_audio_after)
        )
        stringResource(R.string.note_upload_video) -> mapOf(
            "method" to "video",
            "tip" to stringResource(R.string.note_uploadvideo_tip),
            "takeMediaBefore" to stringResource(R.string.note_take_video_before),
            "takeMediaAfter" to stringResource(R.string.note_take_video_after)
        )
        stringResource(R.string.note_gen_code),
        stringResource(R.string.note_gen_image),
        stringResource(R.string.note_text_generate) -> mapOf(
            "aiMode" to stringResource(R.string.note_generate),
            "tip" to stringResource(R.string.note_uploadimage_tip),
            "progressInfo" to stringResource(R.string.note_generate_loading),
            "confirmButtonText" to stringResource(R.string.note_insert_current),
            "resultTip" to stringResource(R.string.note_has_inserted_current),

        )
        stringResource(R.string.manage_create) -> mapOf(
            "aiMode" to stringResource(R.string.note_generate),
            "progressInfo" to stringResource(R.string.note_generate_loading),
            "confirmButtonText" to stringResource(R.string.note_confirm),
            "resultTip" to ""
        )
        stringResource(R.string.note_translation) -> mapOf(
            "aiMode" to stringResource(R.string.note_translate),
            "progressInfo" to stringResource(R.string.note_translate_loading),
            "confirmButtonText" to stringResource(R.string.note_insert_current),
            "resultTip" to stringResource(R.string.note_has_inserted_current)
        )
        stringResource(R.string.note_ocr),
        stringResource(R.string.note_convert_audio)-> mapOf(
            "method" to if (dialogTitle == stringResource(R.string.note_ocr)) "image" else "audio",
            "aiMode" to stringResource(R.string.note_recognize),
            "progressInfo" to stringResource(R.string.note_recognize_loading),
            "confirmButtonText" to stringResource(R.string.note_insert_current),
            "resultTip" to stringResource(R.string.note_has_inserted_current)
        )
        else -> mapOf()
    }

/**
 * 获取指定模式下 footer 按钮的所有变化文字
 */
@Composable
fun getGenerateButtons(aiMode: String): List<String> =
    when (aiMode) {
        stringResource(R.string.note_extract) -> listOf(
            stringResource(R.string.note_extract),
            stringResource(R.string.note_extracting),
            stringResource(R.string.note_extract_again)
        )
        stringResource(R.string.note_polish) -> listOf(
            stringResource(R.string.note_polish),
            stringResource(R.string.note_polishing),
            stringResource(R.string.note_polish_again)
        )
        stringResource(R.string.note_generate) -> listOf(
            stringResource(R.string.note_generate),
            stringResource(R.string.note_generating),
            stringResource(R.string.note_generate_again)
        )
        stringResource(R.string.note_recognize) -> listOf(
            stringResource(R.string.note_recognize),
            stringResource(R.string.note_recognizing),
            stringResource(R.string.note_recognize_again)
        )
        stringResource(R.string.note_translate) -> listOf(
            stringResource(R.string.note_translate),
            stringResource(R.string.note_translating),
            stringResource(R.string.note_translate_again)
        )
        else -> listOf()
    }
